﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.templates;
using l1cs.server.serverpackets;

namespace l1cs.server.model.Instance
{
    public class L1FurnitureInstance : L1NpcInstance
    {
        private static Logger _log = Logger.getLogger( typeof( L1FurnitureInstance ).FullName );

        private int _itemObjId;

        public L1FurnitureInstance( L1Npc template ) : base( template ) { }

        override
        public void onAction( L1PcInstance player ) { }

        override
        public void deleteMe()
        {
            _destroyed = true;
            if ( getInventory() != null )
            {
                getInventory().clearItems();
            }
            L1World.getInstance().removeVisibleObject( this );
            L1World.getInstance().removeObject( this );
            foreach ( L1PcInstance pc in L1World.getInstance().getRecognizePlayer( this ) )
            {
                pc.removeKnownObject( this );
                pc.sendPackets( new S_RemoveObject( this ) );
            }
            removeAllKnownObjects();
        }

        public int getItemObjId()
        {
            return _itemObjId;
        }

        public void setItemObjId( int i )
        {
            _itemObjId = i;
        }
    }
}
